<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>登录</title>
<script type="text/javascript" src="js/jquery-easyui-1.5.4.2/jquery.min.js"></script>
<script type="text/javascript" src="js/jquery-easyui-1.5.4.2/locale/easyui-lang-zh_CN.js"></script>
<script type="text/javascript" src="js/jquery-easyui-1.5.4.2/jquery.easyui.min.js"></script>
<link rel="stylesheet" type="text/css" href="js/jquery-easyui-1.5.4.2/themes/icon.css"/>
<link rel="stylesheet" type="text/css" href="js/jquery-easyui-1.5.4.2/themes/black/easyui.css"/>
<link rel="stylesheet" type="text/css" href="css/taojin/login.css">
<script type="text/javascript" src="js/taojin/login.js"></script>
</head>
<body>
	<script type="text/javascript">
		
		$(function() {
		/* $('#login-username').next('span').find('input').focus(); */
			$.extend($.fn.validatebox.defaults.rules, {
				username : {
					validator : function(value, param) {
						return value.length >= param[0] && value.length <= param[1]
					},
					message : '用户名必须大于{0}小于{1}'
				},
				passowrd : {
					validator : function(value, param) {
						return value.length >= param[0] && value.length <= param[1]
					},
					message : '密码必须大于{0}小于{1}'
				}

			});
			
			$("#login-submit").linkbutton({
				onClick:function(){
					$("#login-form").form({
						url:'login',
						onSubmit:function(param){
							return	$(this).form('validate');
						},
						success:function(data){
							if (data=='true') {
								location='index';
							}else {
								$.messager.alert('警告',"账号或密码错误!请重试");
								$("#login-password").passwordbox('clear');
							}
						}
						
					}).submit();
				}
			})
		})

		
	</script>
	<div id="login-window" class="easyui-window" title="用户登录"
		style="width: 320px; height: 230px"
		data-options="
		collapsible:false,
		minimizable:false,
		maximizable:false,
		resizeable:false,
		draggable:false,
		closable:false,
		modal:false,
		border:false
	">
	
		<div class="easyui-layout" data-options="fit:true">
			<div data-options="region:'center',border:false" style="padding-left: 20px;padding-top: 20px;">
				<form id="login-form" method="post">
					<div class="login-text-div" >
						<input name="username" class="easyui-textbox" id="login-username" style="width:260px;padding-left:1em;"
						 data-options="iconCls:'icon-man',label:'Username:',prompt:'请输入账号',height:26,
							validateOnBlur:true,validateOnCreate:false,required:true, validType:'username[5,20]'">
					</div>	
					
					<div class="login-text-div">
						<input  name="password" class="easyui-passwordbox" id="login-password" style="width:260px;padding-left: 1em;"
							data-options="label:'Password:',prompt:'请输入密码',height:26
						,validateOnBlur:true,validateOnCreate:false,required:true, validType:'password[5,18]'">
					</div>
				</form>
			<a id="login-submit" class="easyui-linkbutton" style="height:35px;width:100px;margin-top: 30px;margin-left: 90px;" 
				data-options="">登录</a>
			</div>
		</div>
	</div>
	
</body>
</html>